package com.cloud.wms.ui.main.adapter;

import com.chad.library.adapter.base.BaseNodeAdapter;
import com.chad.library.adapter.base.entity.node.BaseNode;
import com.cloud.wms.ui.main.adapter.provider.MineTaskProvider;
import com.cloud.wms.ui.main.adapter.provider.TaskMemberProvider;
import com.cloud.wms.ui.main.entity.TaskEntity;
import com.cloud.wms.ui.main.entity.TaskMemberEntity;

import org.jetbrains.annotations.NotNull;

import java.util.List;

/**
 * @Author:Chen
 * @Date: 2021-01-18 19:43
 * @Description:
 */
public class MineTaskAdapter extends BaseNodeAdapter {
    public static final int EXPAND_COLLAPSE_PAYLOAD = 0x110;
    public static final int MEMBER = 0x100;
    public static final int TASK = 0x101;


    public MineTaskAdapter() {
        super();
        addNodeProvider(new TaskMemberProvider());
        addNodeProvider(new MineTaskProvider());
    }

    @Override
    protected int getItemType(@NotNull List<? extends BaseNode> list, int position) {
        BaseNode node = list.get(position);
        if (node instanceof TaskMemberEntity) {
            return MEMBER;
        } else if (node instanceof TaskEntity) {
            return TASK;
        }
        return -1;
    }
}
